<template>
	<view class="wrap">
		<js-error mode="bottom" ref="jsError"></js-error>
		<view style="padding: 0px 10px;">
			<view  style="margin-bottom: 5px;"><text class="">存货编码：</text>{{model.cinvcode}}</view>
			<view style="margin-bottom: 5px;"><text class="">存货代码：</text>{{model.cinvaddcode}}</view>
			<view style="margin-bottom: 5px;"><text class="">存货名称：</text>{{model.cinvname}}</view>
			<view style="margin-bottom: 5px;"><text class="">仓库：</text>{{model.cwhcode}}</view>
			<view style="margin-bottom: 5px;"><text class="">在库量：</text>{{model.iqty}}</view>
		</view>
		<scroll-view class="scroll-list bg-white" scroll-y="true" :style="[{height:stockListHeight + 'px'}]">
			<u-table>
				<u-tr>
					<u-th>区域</u-th>
					<u-th>货位</u-th>
					<u-th>批次</u-th>
					<u-th>数量</u-th>
				</u-tr>
				<view style=" height: 50vh;overflow: scroll;">
					<view v-for="(item,index) in list" :key='index'>
						<u-tr v-if="list">
							<u-td style="word-break: break-all;"> {{item.areacode}}</u-td>
							<u-td style="word-break: break-all;"> {{item.cposname}}</u-td>
							<u-td>{{item.cbatch}}</u-td>
							<u-td>{{item.iqty}}</u-td>
						</u-tr>
					</view>
					<u-empty v-if="!list" text="暂无数据" mode="data"></u-empty>
				</view>

			</u-table>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				stockListHeight: 0,
				barcode:'',//AA01|2W0243080000I999|JE493ZLQ4-DS|1029U230729HT0200500007|001|5642|1|202303301121|0AAA|M040006||||||||||
				model:{
					cinvcode:'',
					cinvaddcode:'',
					cinvname:'',
					iqty:'',
					list:[],
				},
				list: [],
				flag: '1',
				id:'',
			}
		},
		
		onShow() {},
		onLoad(params) {
			this.id = params.cinvcode;
			var _self = this;
			uni.getSystemInfo({
				success: (e) => { // resu 可以获取当前屏幕的高度
					_self.stockListHeight = e.windowHeight - uni.upx2px(300);
				},
				fail: (res) => {}
			});
			this.loadData();
		},
		methods: {
			loadData(){
				this.$u.api.invApi.getHwCl({cinvcode:this.id}).then(res => {
					this.model = res;
					this.list = res.list;
				})
			},
		}
	}
</script>

<style scoped>
	@import '../asd.css';
	/deep/ .u-checkbox__label{
		display: none ;
	}
</style>